<%@page import="hiring.tong.com.common.*"%>
<%@page import="hiring.tong.com.company.entity.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<%=request.getContextPath()%>/static/common/plugin/Uimaker/css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="<%=request.getContextPath() %>/static/common/plugin/bootstrap-3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="<%=request.getContextPath() %>/static/common/plugin/toastr/toastr.css"/>
<style >
.time{
 color:red;
 dispaly:block;
 position: relative;
 bottom:20px;
  left:780px;


}
.tablest{
 dispaly:block;
 position: relative;
 bottom:20px;
  left:380px;
}






</style>
</head>
<body>
<c:if test="${empty pagemodel }">
<script>
	setTimeout(function() {
		location = '<%=request.getContextPath()%>/ApplicationServlet?command=ApplicationList';
	}, 0);
</script>			
</c:if>
<c:if test="${!empty pagemodel }">
<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">职位审核</a></li>
    </ul>
    </div>
    
<table class="table">
	<caption>
		<strong>一、审核信息：</strong>
			
	</caption>
	<thead>
	<tr>
			<td colspan="7">
			 <form id="conditionForm" action="<%=request.getContextPath() %>/ApplicationServlet?command=ApplicationList" method="post" onsubmit="return validate();">
					审核时间范围:<input class="Wdate" name="pretime" type="text" onClick="WdatePicker()" value="${applications.pretime }" id="pretime">~<input class="Wdate" name="nexttime" type="text" onClick="WdatePicker()" value="${applications.nexttime }" id="nexttime">
					职位名称:<input name="positionname" placeholder="请输入要查询的职位" value="${applications.position$name }"/>
					审核情况：<select name="viref" id="viref">
					<option value="">--请选择--</option>
					<option value="1">未审核</option>
					<option value="2">通过</option>
					<option value="3">拒绝</option>
					<script>
					var status='${applications.status}';
				
					var viref=document.getElementById("viref");
			
					for(var i=0;i<viref.length;i++){
						if(viref[i].value==status){
							viref[i].selected=true;
						}
					}
					
					</script>

					</select>
					<button>查询</button><span id="time" class="time"></span>
				</form>
			</td>
	<tr>
            <th>编号</th>
			<th>职位名称</th>
			<th>求职者</th>
			<th>简历信息</th>
			<th>申请时间</th>
			<th>审核状态</th>
			<th>操作</th>
    </tr>
	</thead>
	<tbody>

		
	
		<%
		PageModel<ApplicationEntity> pagemodel=(PageModel<ApplicationEntity>)request.getAttribute("pagemodel");
		int a=0;
		%>		
		<c:forEach items="${pagemodel.list }" var="application" varStatus="v">
			<tr >
		
			<th scope="row"><%=pagemodel.getLists().get(0)%></th>
				<td>${application.position$name }</td>
				<td><a href="javascript:void(0)">${application.talent$name }</a></td>
				<td><a href="javascript:void(0)">${application.resume$intention }</a></td>
				<td><fmt:formatDate value="${application.appTime }"
						pattern="yyyy-MM-dd HH:mm:ss" /></td>
				<td>
					<c:if test="${application.status == 1 }">
						${application.statues }
					</c:if>
					<c:if test="${application.status != 1 }">
						${application.statues }
						(<fmt:formatDate value="${application.handleTime }" pattern="yyyy-MM-dd HH:mm:ss" />)
					</c:if>
					<td><a href="javascript:verify(${application.id }, ${pagemodel.pageNo });">审核</a></td>
			</tr>
</c:forEach>
	
	</tbody>
	<tr>
<td colspan="7" align="right">
<a href="javascript:submitForm('<%=request.getContextPath()%>/ApplicationServlet?command=ApplicationList&pageNo=${pagemodel.first}')">首页</a>&nbsp;
<a href="javascript:submitForm('<%=request.getContextPath()%>/ApplicationServlet?command=ApplicationList&pageNo=${pagemodel.pre}')">上一页</a>&nbsp;
<a href="javascript:submitForm('<%=request.getContextPath()%>/ApplicationServlet?command=ApplicationList&pageNo=${pagemodel.next}')">下一页</a>&nbsp;
<a href="javascript:submitForm('<%=request.getContextPath()%>/ApplicationServlet?command=ApplicationList&pageNo=${pagemodel.last}')">尾页</a>&nbsp;
第<select onchange="goPage(this)" id="selected">
				 	<script>
				 		var pageNo = '${pagemodel.pageNo }';
				 		var totalPage = '${pagemodel.totalpage }';
				 		for (var i = 1; i <= totalPage; i++) {
				 			if (pageNo == i) {
				 				document.write('<option value="' + i + '" selected="selected">' + i + '</option>');
				 			} else {
				 				document.write('<option value="' + i + '">' + i + '</option>');
				 			}
				 		}
				 		function values(){
				 			var page=document.getElementById("selected").value;
				 			return page;
				 		}
				 	</script>
				 </select>页
共${pagemodel.totalpage }页&nbsp;

共${pagemodel.allRecords }条记录

</table>



</c:if>
<script>
function goPage(object) {
	submitForm('<%=request.getContextPath()%>/ApplicationServlet?command=ApplicationList&pageNo=' + object.value);
}
	/**
	 * 审核
	 */
	 function verify(applicationId, pageNo) {
		    //询问框
		    layer.confirm('通过还是拒绝？', {
		    	closeBtn: 0,
		        icon : 3,
		        btn: ['通过','拒绝'] //按钮
		    }, function(){
		        layer.msg('您选择了通过！', {icon: 1, time: 1000});
		        submitForm('<%=request.getContextPath()%>/ApplicationServlet?command=verify&status=2&applicationId=' + applicationId + '&pageNo=' + pageNo);
		    }, function(){
		        layer.msg('您选择了拒绝！', {icon: 2, time: 1000});
		        submitForm('<%=request.getContextPath()%>/ApplicationServlet?command=verify&status=3&applicationId=' + applicationId + '&pageNo=' + pageNo);
		    });
		}
	//分页条件查询
	 function submitForm(url) {
			var conditionForm = document.getElementById('conditionForm');
			conditionForm.action = url;
			conditionForm.submit();
		}
	//时间表单验证
	function validate(){
	var falg=false;	
	var pretime=document.getElementById('pretime').value;
	var nexttime=document.getElementById('nexttime').value;
	if(pretime>nexttime&&nexttime!=''){
		document.getElementById('time').innerHTML = '时间不符合要求，前面时间必须小于后面！'
	}	
	else{
		document.getElementById('time').innerHTML ='';
		falg=true;
	}
	return falg;
	}
	 </script>
</body>
<script language="javascript" type="text/javascript" src="<%=request.getContextPath() %>/static/common/plugin/My97DatePicker/WdatePicker.js"></script>
<script src="<%=request.getContextPath() %>/static/common/plugin/jquery.min.js"></script>
<script src="<%=request.getContextPath() %>/static/common/plugin/layer/layer.js"></script>

</html>
